interface MenuItemss {
  url: string
  name: string
  icon: string
  children?: MenuItemss[]
}
export const SET_MENU = (menuList: MenuItemss[]) => {
  localStorage.setItem('menuList', JSON.stringify(menuList))
}

export const GET_MENU = (): MenuItemss[] => {
  // 从 localStorage 读取并转换回原始类型, as MenuItem[]为ts的类型断言，将结果指定为MenuList类型
  const storedMenuList = JSON.parse(
    localStorage.getItem('menuList') || '[]',
  ) as MenuItemss[]
  return storedMenuList
}
